package com.example.vo.zyz;

import java.util.List;

public class pageBean {

	  private int pagesize; //每页条数
	  private int pagenum;//当前页数
	  private int rowcount;//总行数
	  private List<?> pagedata;//存放的数据
	  private int nextpage;//下一页
	  private int previouspage;//上一页
	  private int maxpage;//总页数
	public pageBean() {
		super();
	}
	
	public pageBean(int pagenum, List<?> pagedata) {
		super();
		this.pagenum = pagenum;
		this.pagedata = pagedata;
	}

	public int getPagesize() {
		return pagesize;
	}
	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}
	public int getPagenum() {
		return pagenum;
	}
	public void setPagenum(int pagenum) {
		this.pagenum = pagenum;
	}
	public int getRowcount() {
		return rowcount;
	}
	public void setRowcount(int rowcount) {
		this.rowcount = rowcount;
	}
	public List<?> getPagedata() {
		return pagedata;
	}
	public void setPagedata(List<?> pagedata) {
		this.pagedata = pagedata;
	}
	public int getNextpage() {
		return this.pagenum+1>=this.getMaxpage()?this.getMaxpage():this.pagenum+1;
	}
	public void setNextpage(int nextpage) {
		this.nextpage = nextpage;
	}
	public int getPreviouspage() {
		return this.pagenum-1<=0?0:this.pagenum-1;
	}
	public void setPreviouspage(int previouspage) {
		this.previouspage = previouspage;
	}
	public int getMaxpage() {
		return (int)Math.ceil((double)rowcount/pagesize)-1;
	}
	public void setMaxpage(int maxpage) {
		this.maxpage = maxpage;
	}

	
	public pageBean(int pagesize, int pagenum, int rowcount, List<?> pagedata,
			int nextpage, int previouspage, int maxpage) {
		super();
		this.pagesize = pagesize;
		this.pagenum = pagenum;
		this.rowcount = rowcount;
		this.pagedata = pagedata;
		this.nextpage = nextpage;
		this.previouspage = previouspage;
		this.maxpage = maxpage;
	}
	@Override
	public String toString() {
		return "PageBean [pagesize=" + pagesize + ", pagenum=" + pagenum
				+ ", rowcount=" + rowcount + ", pagedata=" + pagedata
				+ ", nextpage=" + nextpage + ", previouspage=" + previouspage
				+ ", maxpage=" + maxpage + "]";
	}
	  

}
